//
//  SCAudioPlayer.h
//  SCAudioPlayer
//
//  Created by 盛超 on 2018/7/25.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>

typedef NS_ENUM(NSUInteger,MAudioPlayState) {
    MAudioStatePlaying = 1,
    MAudioStatePaused,
    MAudioStateWaiting,
    MAudioStateEnd,
};

@protocol BKAudioPlayerDelegate <NSObject>

- (void)audioUpdateWith:(float)time Totaltime:(float)totalTime;

-(void)audioPlayEnd;

@end

@interface BKDictAudioPlayer : NSObject

@property (nonatomic,copy) NSString *url;
@property (nonatomic ,strong) AVPlayerItem *playerItem;
@property (nonatomic ,strong,readonly) AVPlayer *player;
@property (nonatomic, assign, readonly) NSInteger currentTime;/*!*当前播放器时间*/
@property (nonatomic, assign, readonly) NSInteger totalTime;/*!*当前播放器总时间*/
@property (nonatomic, assign,readonly) MAudioPlayState playerState;/*用枚举定义了播放器状态*/
@property (nonatomic, assign) float ratevalue;/*!*倍速*/
@property (nonatomic, assign) id<BKAudioPlayerDelegate>delegateM;

/**
 初始化播放器
 
 @param url 播放地址
 @param recordTime 指定时间播放
 @param ratevalue 倍速,1.0~2.0倍速播放
 */
- (void)playerUrl:(NSString *)url seekTotime:(NSInteger)recordTime rateValue:(float)ratevalue;
+ (instancetype)sharedMPlayer;
- (void)playerPaused;//暂停播放方法
- (void)playerPlay;//开启播放
- (void)closePlayer;//移除播放器

//-(void)SetlockScreenInformation:(DetailCourseListModel *)model;//锁屏方法,model根据需求自定义

@end
